﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RRHH.Entities;
using System.Data.SqlClient;
using System.Data;


namespace RRHH.DataAccess
{
    public class DAOBanco
    {
                
        public List<BEBanco> ListarBanco()
        {

            string sql = "SP_LISTAR_BANCO";

            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.CommandText = sql;

            using (DataAccess adoDataService = new DataAccess())
            {

                List<BEBanco> _BLBanco = new List<BEBanco>();
                IDataReader dr = adoDataService.ExecuteReader(sqlCommand);

                while (dr.Read())
                {
                    BEBanco _BEBanco = new BEBanco();
                    _BEBanco.idAuto = Convert.ToInt32(dr["IDAUTO"]);
                    _BEBanco.descripcion = Convert.ToString(dr["DESCRIPCION"]);
                    _BEBanco.estado = Convert.ToString(dr["ESTADO"]);
                    _BLBanco.Add(_BEBanco);
                }
                dr.Close();

                adoDataService.Dispose();

                return _BLBanco;
            }

        }
    }
}
